import React from "react";

class NavigationBar extends React.Component{
  constructor(props){
    super(props)
    // console.log(props)
    this.state = {
      title:""
    }
  }

  render(){
    return(
      <div>
        <div>{this.state.title}</div>
        <button onClick={()=>{
          this.props.sendMessage("我是子组件传递给父组件的数据")
        }}>点击</button>
      </div>
    )
  }

  componentDidMount(){
    this.setState({
      title:this.props.title
    })
  }
}

export default NavigationBar


